{/* LAYOUT模板 */}
<layout name="layout"/>
{/* LAYOUT模板 */}
{/* import Js,Css */}
<css href="__THEMES__/css/common.css" />
<css href="__CSS__/jquery-ui.css" />
<js href="__JS__/core/jquery-1.8.0.js" />
<js href="__JS__/core/jquery-ui.1.10.4.js" />
<js href="__JS__/core/plugins.js" />
{/* import Js,Css */}

<div id="loading"><!--QLoading加载条--></div>

<style>
.agent-title-wrap{margin-top:20px;}.agent-title-wrap h1{font-size:14px; height:35px;display:block;max-width:100%;text-align:center;line-height:35px;background:#F8F8F8;border-top:1px solid #D7D7D7;border-bottom:1px solid #D7D7D7;}.area{padding: 21px 0 18px 20px;}.area a{height: 21px;padding: 0 6px;color: #3f3f3f;margin-right: 6px;margin-bottom: 3px;display: inline-block;text-align: center;font-size: 13px;line-height: 21px;}a{text-decoration: none;color: #515151;}.area_b{border-top: 1px solid #d7d7d7;}.area a{height: 21px;padding: 0 6px;color: #3f3f3f;margin-right: 6px;margin-bottom: 3px;display: inline-block;text-align: center;font-size: 13px;line-height: 21px;}.address_h2{margin-top: 20px;font-size: 18px;text-indent: 8px;padding-bottom: 14px;border-bottom: 1px solid #d7d7d7;}a{text-decoration: none;}.retail_list li{padding: 26px 0 0 80px;width: 550px;height: 128px;margin-left: 10px;border-bottom: 1px solid #d7d7d7;}.retail_list li strong{display: block;font-size: 18px;color: #32a5e7;}.retail_list li span{display: block;margin-top: 6px;color: #515151;}ul,li{list-style: none;}.area a.act{background:#00A7EA;color:#fff;}.area a.act{background:#00A7EA;color:#fff;}
/*img style*/
.img-wrap {}
.img-wrap .img {width:100%;height:300px;background:url('__THEMES__/images/banner.jpg') no-repeat top center;}
.area a .num{
	display:block;position:absolute;top:-6px;right:-2px;background:#FF6600;border-radius:15px;
	width:15px;height:15px;text-align:center;font-size:6px;line-height:15px;color:#ffffff;}
</style>




<div class="img-wrap w_1200 mauto">
	<div class="img"></div>
</div>

<!--#代理商查询#-->
<div class="container" style="width:1200px;margin-bottom:100px;">
	<div class="agent-title-wrap">
		<h1 class="title">全国代理商代理点查询</h1>
	</div>
	<!--省-->
	<div id="province-list" class="area">
		<volist name="province_list" id="province">
			<a id="province_{$province.region_id}"  style="position:relative;" href="javascript:;" <if condition="$key eq 0"> class="act" </if> region_id="{$province.region_id}" region_type="{$province.region_type}">
				{$province.region_name}
				<if condition="$province['retail_amount'] neq 0">
					<i class="num">{$province.retail_amount}</i>				
				</if>
			</a>
		</volist>
	</div>
	<!--省-->
	<!--市-->
	<div id="city-wrap" class="area area_b"></div>
	<!--市-->
	<!--详细地址-->
	<style>
	</style>
	<h2 class="address_h2">详细地址</h2>
	<!--详细地址-->
	<!--详细地址列表-begin-->
	<ul id="retail-list" class="retail_list clearfix" style="min-height:600px;">		
		<div class="clearer"></div>
	</ul>
	<!--详细地址列表-end-->
</div>

<script>
//初始化城市
function init_city(){
	var region_id = $('#province-list').find('a.act').attr('region_id');
	var region_type = $('#province-list').find('a.act').attr('region_type');
	/*show region*/
	show_region(region_id,region_type);
}
//初始化地区
function init_retail(){
	var region_id 	=	$('#city-wrap').find('a.act').attr('region_id');
	var parent_id	=	$('#city-wrap').find('a.act').attr('parent_id');
	$.ajax({
		url:'__URL__/get_retail_list',
		type:'post',
		dataType:'json',
		data:{region_id:region_id,parent_id:parent_id},
		beforeSend:function(){
			$('#loading').QLoading({text:'',status:'open',modal:false});
		},
		success:function(msg){
			$('#retail-list').html('').html(msg);
			$('#loading').QLoading({status:'close',text:'',time:0.2,modal:false});						
		}
	});
}

//显示地区
function show_region(region_id,region_type){
	$.ajax({
		url:'__URL__/get_city_list',
		type:'post',
		dataType:'json',
		data:{region_id:region_id,region_type:region_type},
		beforeSend:function(){
			$('#loading').QLoading({text:'',status:'open',modal:false});
		},
		success:function(msg){
			$('#city-wrap').html('').html(msg);
			$('#retail-list').html('');
			$('#loading').QLoading({status:'close',text:'',time:0.2,modal:false});
			//成功后调用init_retail
			init_retail();
		}
	});
}

//显示代理商信息
function show_retail(region_id,parent_id){	
	$.ajax({
		url:'__URL__/get_retail_list',
		type:'post',
		dataType:'json',
		data:{region_id:region_id,parent_id:parent_id},
		beforeSend:function(){
			$('#loading').QLoading({text:'',status:'open',modal:false});
		},
		success:function(msg){
			$('#retail-list').html('').html(msg);
			$('#loading').QLoading({status:'close',text:'',time:0.2,modal:false});
		}
	});
}

//显示代理商列表
function show_retail_list(id){
	var obj = $('#' + id);
	var region_id = obj.attr('region_id');
	var parent_id = obj.attr('parent_id');					
	/*show retail*/
	show_retail(region_id,parent_id);
}

$(document).ready(function(){
	/*初始化城市*/	
	init_city();
	
	$('.retail_list').find('li').each(function(){
		$(this).hover(function(){
			$(this).css('border-bottom',"1px solid green");
		},function(){
			$(this).css('border-bottom',"1px solid #d7d7d7");
		});
	});
	/*选择省份*/
	$('#province-list').find('a').each(function(){		
		$(this).live('click',function(){
			var region_id = $(this).attr('region_id');
			var region_type = $(this).attr('region_type');
			//遍历移除样式
			$('#province-list').find('a').each(function(){
				$(this).removeClass('act');
			});
			$(this).addClass('act'); //添加样式
			/*show region*/
			show_region(region_id,region_type);
		});
	});
	//选择城市
	$('.city-item').live("click",function(){
		$('.city-item').each(function(){
			$(this).removeClass('act');
		});
		$(this).addClass('act');
		var region_id = $(this).attr('region_id');
		var region_type = $(this).attr('parent_id');
		show_retail(region_id,region_type);
	});
	
});	

</script>


<div class="space"></div>
<include file="Library:service"/>
<include file="Library:footer"/>







